<?php

class LoanWriteOffCharges extends HTech_Db_Table
{
    protected $_name     = 'view_loan_write_off_charges';
    protected $_primary  = 'WriteOffChargeId';
    
    protected $_referenceMap    = array(
        'Loans' => array(
            'columns'           => array('LoanId'),
            'refTableClass'     => 'Loans',
            'refColumns'        => array('LoanId')
        ),
        'LoanWriteOffs' => array(
            'columns'           => array('LoanId'),
            'refTableClass'     => 'LoanWriteOffs',
            'refColumns'        => array('LoanId')
        )
    );
    
    protected function _setGridMetadata()
    {
        $this->_gridMetadata['title'] = $this->translate("Loan write off charges");
        $this->_gridMetadata['params'] = array('LoanId');
        $this->_gridMetadata['onClick'] = 'loan.write-off-charge.add';
        $this->_gridMetadata['headers'] = array
            (
                array('WriteOffChargeId', 50, $this->translate("Id"),       'Number'),
                array('Amount',           80, $this->translate("Amount"),   'Number',   'Standard'),
                array('LastEditDate',    150, $this->translate("Date"),     'DateTime', 'Date'),
                array('User',            100, $this->translate("User"),     'String'),
                array('Comments',        300, $this->translate("Comments"), 'String')
            );
        return $this;
    }
}